package com.tutorialspoint;

import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;

public class MainApp {
	@SuppressWarnings({ "resource", "deprecation" })
	public static void main(String[] args){
		//ClassPathXmlApplicationContext记载beans文件，初始化所有对象
		ApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml");
		XmlBeanFactory factory = new XmlBeanFactory(new ClassPathResource("Beans.xml"));
		
			//获取bean，
	      HelloWorld obj = (HelloWorld) factory.getBean("helloWorld");
	      //调用对象的类方法
	      obj.getMessage();
	      
	}
}
